package BLController.promotion;

import java.util.*;
import businessLogic.promotion.*;
import vo.*;

public class CMan_PromotionBL_Controller {
	CMan_PromotionBL_Stub pBL;
	public CMan_PromotionBL_Controller(){
		pBL=new CMan_PromotionBL_Stub();
	}
	public ArrayList<VO_Coupon> showExistedStrategy(){
		ArrayList<VO_Coupon> result=new ArrayList<VO_Coupon>();
		for(VO_Coupon c:pBL.showExistedIntegralRule())
			result.add(c);
		for(VO_Coupon c:pBL.showExistedEquivalence())
			result.add(c);
		for(VO_Coupon c:pBL.showExistedDiscount())
			result.add(c);
		return result;
	}
	public   ArrayList<VO_IntegralExchange>  showExistedIntegralRule(){
		return pBL.showExistedIntegralRule();
	}

	public boolean setIntegralExchangeRule(int integral,int price,String startDate,String  endDate){
		return pBL.setIntegralExchangeRule(new VO_IntegralExchange(integral, price, startDate, endDate));
	}

	public  ArrayList<VO_EquivalencePaper>  showExistedEquivalence(){
		return pBL.showExistedEquivalence();
	}

	public boolean setEquivalence(int price,int value,int maxPrice,String startDate,String endDate){
		return pBL.setEquivalence(new VO_EquivalencePaper(0,price, value, maxPrice, startDate, endDate));
	}

	public ArrayList<VO_DiscountPaper> showExistedDiscount(){
		return pBL.showExistedDiscount();
	}

	public boolean setDiscount(int price,double discount,String startDate,String endDate){
		return pBL.setDiscount(new VO_DiscountPaper(0, price, discount, startDate, endDate));
	}

	public boolean deleteStrategy(int index){
		return true;
	}
	public boolean setIntegralExchangeRuleAsRank(int rank,int integral,int price,String startDate,String  endDate) {
		return pBL.setIntegralExchangeRule(new VO_IntegralExchange(rank,integral,price,startDate,endDate));
	}
	public boolean setEquivalenceAsRank(int rank,int value,int maxPrice,String startDate,String endDate){
		return pBL.setEquivalence(new VO_EquivalencePaper(rank,0, value, maxPrice, startDate, endDate));
	}

	public boolean setDiscountAsRank(int rank,double discount,String startDate,String endDate){
		return pBL.setDiscount(new VO_DiscountPaper(rank, 0, discount, startDate, endDate));
	}
}
